#include "time.h"
//init timer 1
sbit LED20 = P2 ^ 0;

void time0_init(void){
// init timer 0
    TMOD = 0x01; // Timer 1, mode 1, 16-bit timer
    TH0 = 0xFC; // 1ms
    TL0 = 0x18;
    ET0 = 1; // Enable timer 1 interrupt
    EA = 1; // Enable global interrupt
    TR0 = 1; // Start timer 1


}

// Timer 1 interrupt service routine
void time1() interrupt 3
{
    static unsigned int i = 0;
    i++;
    if (i == 1000)
    {
        i = 0;
        LED20 = ~LED20;
    }
}



